var t = require("../../../@babel/runtime/helpers/interopRequireDefault").default,
  e = require("../../../utils/http"),
  a = t(require("../../../utils/util")),
  i = new e.HTTP;
Page({
  data: {
    selectArray: [{
      id: 1,
      text: "请选择更换指标的招商员"
    }],
    sortType: 1
  },
  selectEvent: function (t) {
    var e = this;
    e.setData({
        sortType: t.detail.selectedID,
        nowTexta: t.detail.nowText
      }),
      i.request({
        url: "https://www.qlsyyun.com:3030/revise/quota",
        data: {
          arr: 2,
          month: a.default.formatDates(new Date),
          name: t.detail.nowText
        }
      }).then((function (t) {
        var a = t.data[0];
        e.setData({
          carrier: a.carrier,
          taxation: a.taxation,
          adds: a.adds,
          fund: a.fund,
          talent: a.talent,
          high: a.high,
          visit: a.visit,
          onlines: a.onlines,
          ditch: a.ditch,
          imports: a.imports,
          tech: a.tech,
          direction: a.direction
        })
      }))
  },
  quxiao: function () {
    wx.navigateBack({
      delta: 1
    })
  },
  formSubmit: function (t) {
    var e = this,
      n = t.detail.value;
    null == e.data.nowTexta ? wx.showToast({
      title: "尚未选择指标人员",
      icon: "success",
      duration: 1e3
    }) : wx.showModal({
      title: "提示",
      content: "请核对数据是否正确",
      success: function (t) {
        t.confirm ? i.request({
          url: "https://www.qlsyyun.com:3030/revise/people",
          header: {
            "Content-Type": "application/x-www-form-urlencoded"
          },
          method: "POST",
          data: {
            carrier: n.carrier,
            taxation: n.taxation,
            adds: n.adds,
            fund: n.fund,
            talent: n.talent,
            high: n.high,
            visit: n.visit,
            onlines: n.onlines,
            ditch: n.ditch,
            imports: n.imports,
            tech: n.tech,
            direction: n.direction,
            name: e.data.nowTexta,
            month: a.default.formatDates(new Date)
          }
        }).then((function (t) {
          i.request({
            url: "https://www.qlsyyun.com:3030/revise/note",
            header: {
              "Content-Type": "application/x-www-form-urlencoded"
            },
            method: "POST",
            data: {
              name: e.data.user[0],
              time: a.default.formatTime(new Date),
              title: "修改了" + e.data.nowTexta + "的载体区划为" + n.carrier + "，总税收为" + n.taxation + "，新增税收为" + n.adds + "，新增税源为" + n.fund + "，人才获批量为" + n.talent + "，高企获批为" + n.high + "，拜访来访为" + n.visit + "，线上沟通为" + n.onlines + "，新增渠道为" + n.ditch + "，人才引进为" + n.imports + "，高企引进为" + n.tech + "，其他为" + n.direction
            }
          }).then((function (t) {
            wx.showToast({
              title: "修改指标成功",
              icon: "success",
              duration: 1e3,
              success: function () {
                setTimeout((function () {
                  wx.navigateBack({
                    delta: 1
                  })
                }), 1e3)
              }
            })
          }))
        })) : t.cancel && console.log("用户点击取消")
      }
    })
  },
  onLoad: function () {
    var t = wx.getStorageSync("user"),
      e = this;
    i.request({
      url: "https://www.qlsyyun.com:3030/revise/quota",
      data: {
        arr: 1,
        month: a.default.formatDates(new Date)
      }
    }).then((function (a) {
      e.setData({
        selectArray: a.data,
        user: t
      })
    }))
  }
});